all: mywget

mywget : mywget.o  http.o  log.o  progress.o  url.o  wget.o  wget_opt.o
	cc $^ -std=gnu99 -o $@

%.o : CFLAGS = -std=gnu99

sources = mywget.c  http.c  log.c  progress.c  url.c  wget.c  wget_opt.c

include $(sources:.c=.d)

%.d: %.c
	set -e; rm -f $@; \
	$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	rm -f $@.$$$$


clean:
	-rm mywget *.o *.d

.PHONY: clean

